//
//  LjjAvPlayerVc.m
//  视频播放器
//
//  Created by 1 on 2017/7/31.
//  Copyright © 2017年 junjie.liu. All rights reserved.
//

#import "LjjAvPlayerVc.h"
#import <AVFoundation/AVFoundation.h>
#import "LjjPlayerVideo.h"

#define MainWidth [UIScreen mainScreen].bounds.size.width
#define MainHeight [UIScreen mainScreen].bounds.size.height


@interface LjjAvPlayerVc ()

@property (nonatomic, strong) LjjPlayerVideo *video;

@end

@implementation LjjAvPlayerVc

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blueColor];
    
    self.video = [LjjPlayerVideo videoPlayView];
    self.video.view.frame= self.video.frame;
    self.video.view.backgroundColor = getColor(navColor);
    self.video.videoUrl = @"http://hc34.aipai.com/user/128/31977128/6009407/card/44044719/card.mp4?l=f";
    self.video.contrainerViewController = self;
    self.video.barrageData = [NSMutableArray arrayWithObjects:@"我是弹幕1我是弹幕1",@"我是弹幕2",@"我是弹幕33",@"888",@"666",nil];
    [self.view addSubview:self.video.view];
    
    self.video.backBlockCrossScreen = ^(id type) {
        NSLog(@"竖屏切横屏");
    };
    
    self.video.backBlockVerticalScreen = ^(id type) {
        NSLog(@"横屏切竖屏");
    };
    
    self.video.barrage = ^(NSString *text) {
        NSLog(@"发送的弹幕内容为:%@",text);
    };
    UIButton *btn1 =[[UIButton alloc]initWithFrame:CGRectMake(0,0, 22, 22)];
    
    [btn1 addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
    [btn1 setBackgroundImage:[[UIImage imageNamed:@"fanhui"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:btn1];
    self.navigationItem.leftBarButtonItem  = item;
    
    
}

-(void)onClick:(UIButton *)btn{
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
